package com.sanyang.pda.adapter;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.sanyang.pda.bean.TakeStockBean;
import com.sanyang.pda.utils.Utils;
import com.wangshen.base.ui.mvp.base.adapter.BaseAdapter;
import com.wangshen.projectbase.R;

import java.util.List;

public class StockAdapter extends BaseAdapter<TakeStockBean> {
    public StockAdapter(int layoutResId, @Nullable List<TakeStockBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, TakeStockBean item) {
        super.convert(helper, item);
        helper.setText(R.id.tv_name,item.getArticleName());
        helper.setText(R.id.tv_admire_date,item.getExpiringTime());
        helper.setText(R.id.tv_batch,item.getBatchNo());
        helper.setText(R.id.tv_inventory,item.getStockNum()+ Utils.getArticleUnit(getContext(),item.getArticleUnit()));
        helper.setText(R.id.tv_state,Utils.getTakeStockState(getContext(),item.getComparisonResult()));
    }
}
